from django.db import models

# Create your models here.
class AdGroup(models.Model):
    name = models.CharField(max_length=300, verbose_name=u'组')
    star_time = models.DateTimeField(auto_now_add=True, verbose_name=u'创建日期')
    last_time = models.DateTimeField(auto_now=True, verbose_name=u'最后一次修改日期')
    isDelete = models.BooleanField(default=True, verbose_name=u'是否可用')
    def __str__(self):
        return self.name

    class Meta:
        verbose_name_plural = "广告分组"


class AdData(models.Model):
    name = models.CharField(max_length=200, verbose_name=u'名称')
    msg =  models.CharField(max_length=200, verbose_name=u'描述')
    img = models.TextField(max_length=3000, verbose_name=u'图片地址')
    url = models.TextField(max_length=3000, verbose_name=u'指向链接')
    ClassID = models.ForeignKey(
        'AdGroup', on_delete=models.CASCADE, verbose_name=u'组')
    star_time = models.DateTimeField(auto_now_add=True, verbose_name=u'创建日期')
    last_time = models.DateTimeField(auto_now=True, verbose_name=u'最后一次修改日期')
    isDelete = models.BooleanField(default=True, verbose_name=u'是否可用')
    config = models.TextField(max_length=3000, verbose_name=u'配置',default='[]')

    def __str__(self):
        return self.name

    class Meta:
        verbose_name_plural = "具体广告数据"

